package tcpMVMX;

import java.io.DataInputStream;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Server {
    public static void main(String[] args) throws Exception {
        //创建ServerSocket对象，同时为服务端注册端口
        ServerSocket serverSocket = new ServerSocket(9999);
        System.out.println("------服务端启动------");
        Socket socket = null;
        try {
            while (true) {
                //使用ServerSocket对象，调用accept方法，等到客户端链接
                socket = serverSocket.accept();
                System.out.println("线程启动了： " + socket.getRemoteSocketAddress());
                //线程启动
                new ThreadM(socket).start();
            }
        } catch (Exception ignored) {

        }
    }
}
